﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;

namespace DigitalSolutionControls
{
    public class IconButton : Button
    {
        private ButtonType type;

        public enum ButtonType
        {
            NONE,
            OK,
            CANCEL,
            NEXT,
            PREVIOUS,
            FIRST,
            LAST,
            ADD,
            SAVE,
            DELETE,
            EDIT,
            EMAIL,
            RELOAD
        }

        public ButtonType Type { 
            get 
            {
                return type;
            }
            set
            {
                type = value;
                switch (type)
                {
                    case ButtonType.CANCEL:
                        Image = Properties.Resources.ic_button_cancel;
                        break;
                    case ButtonType.NONE:
                        Image = null;
                        break;
                    case ButtonType.OK:
                        Image = Properties.Resources.ic_button_ok;
                        break;
                    case ButtonType.FIRST:
                        Image = Properties.Resources.ic_button_first;
                        break;
                    case ButtonType.LAST:
                        Image = Properties.Resources.ic_button_last;
                        break;
                    case ButtonType.NEXT:
                        Image = Properties.Resources.ic_button_next;
                        break;
                    case ButtonType.PREVIOUS:
                        Image = Properties.Resources.ic_button_previous;
                        break;
                    case ButtonType.ADD:
                        Image = Properties.Resources.ic_button_add;
                        break;
                    case ButtonType.SAVE:
                        Image = Properties.Resources.ic_button_save;
                        break;
                    case ButtonType.DELETE:
                        Image = Properties.Resources.ic_button_del;
                        break;
                    case ButtonType.EDIT:
                        Image = Properties.Resources.ic_button_edit;
                        break;
                    case ButtonType.EMAIL:
                        Image = Properties.Resources.ic_button_email;
                        break;
                    case ButtonType.RELOAD:
                        Image = Properties.Resources.ic_button_reload;
                        break;
                }
            }
        }

        [Browsable(false)]
        public override Size MinimumSize { get; set; }

        public IconButton()
        {
            Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            MinimumSize = new System.Drawing.Size(35, 35);
            TextImageRelation = TextImageRelation.ImageBeforeText;
            type = ButtonType.NONE;
        }
    }
}
